//
//  MeFiveImageCell.m
//  CenturyCity
//
//  Created by beisheng03 on 2017/12/6.
//  Copyright © 2017年 beisheng. All rights reserved.
//

#import "MeFiveImageCell.h"
#import "MeOneImageCell.h"
#import "WineCategoryVC.h"
@interface MeFiveImageCell ()<UICollectionViewDelegate,UICollectionViewDataSource>

@property (weak, nonatomic) IBOutlet UICollectionView *myCollectionView;

@end

@implementation MeFiveImageCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.contentView.backgroundColor = randomColor;
    self.myCollectionView.delegate = self;
    self.myCollectionView.dataSource = self;
    [self.myCollectionView registerNib:[UINib nibWithNibName:NSStringFromClass([MeOneImageCell class]) bundle:nil] forCellWithReuseIdentifier:[MeOneImageCell identifierStr]];
    
    if (myViewModel.hideShopping) {
        self.myCollectionView.hidden = YES;
    } else {
        self.myCollectionView.hidden = NO;

    }
    
}

- (void)setModel:(MyAllOrderCount *)model{
    
    _model = model;
    
    [self.myCollectionView reloadData];
    
    
}


- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView{
    
    return 1;
}



- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    
    
    return 5;
}



- (__kindof UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    MeOneImageCell *temp = (MeOneImageCell *)[collectionView dequeueReusableCellWithReuseIdentifier:[MeOneImageCell identifierStr] forIndexPath:indexPath];
    
    temp.countModel = self.model;
        
    temp.index = indexPath;
    
    return temp;
        
   
}


- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath{
    
    
    WineCategoryVC *temp = [[WineCategoryVC alloc]init];
    
    temp.type = @"oneOrder";
    
    temp.seletIndex = indexPath.item + 1;
    
    [self.viewController.navigationController pushViewController:temp animated:YES];
    
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

}

@end
